package com.littleu.yojoincn.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.littleu.yojoincn.common.mybatis.Page;
import com.littleu.yojoincn.dto.item.ItemSkuQueryDTO;
import com.littleu.yojoincn.mapper.ItemMapper;
import com.littleu.yojoincn.model.ItemDO;
import com.littleu.yojoincn.model.ItemSkuDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ItemService extends ServiceImpl<ItemMapper, ItemDO> {
    @Autowired
    private ItemSkuService itemSkuService;

    public IPage<ItemSkuDO> getItemSkuPaging(Integer page, Integer count) {
        Page<ItemSkuDO> pager = new Page<>(page, count);
        return itemSkuService.getBaseMapper().selectPage(pager, null);
    }

    public List<ItemSkuDO> getItemSkuWithoutPage(ItemSkuQueryDTO dto) {
        return this.itemSkuService.getBaseMapper().selectItemSkuWithoutPage(dto.getItemName());
    }
}
